package com.springboot.service;

import com.hqj.ReturnUtil;
import com.springboot.domain.User;
import com.springboot.mapper.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class UserServceI {

    @Autowired
    private UserDao ud;

    public List<User> findUser(User u){
        return ud.findUsers(u);
    }

    public Map<String,Object> addUser(User u){
        int i = ud.addUser(u);
        return ReturnUtil.returnMap(i>0,"新增");
    }

    public Map<String,Object> editUser(User u){
        int i = ud.editUser(u);
        return ReturnUtil.returnMap(i>0,"编辑");
    }

    public Map<String,Object> removeUser(int id){
        int i = ud.removeUser(id);
        return ReturnUtil.returnMap(i>0,"删除");
    }

    public List<User> findUser2(){
        return ud.findUser2();
    }

    public List<User> findUser3(){
        return ud.findUser3();
    }
}
